﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:vm="clr-namespace:Tum.PDE.ToolFramework.Modeling.Visualization.ViewModel.Dependencies"
                    xmlns:ctrl="clr-namespace:Tum.PDE.ToolFramework.Modeling.Visualization.Controls.DiagramSurface"
                    xmlns:dCtrl="clr-namespace:Tum.PDE.ToolFramework.Modeling.Visualization.Controls.Dependencies">
    <DataTemplate DataType="{x:Type vm:GraphicalDependencyHostViewModel}">
        <Grid>
            <Rectangle StrokeDashArray="3 6" Stroke="Silver"/>
            <TextBlock HorizontalAlignment="Center" VerticalAlignment="Bottom" Text="{Binding Path=RelationshipName, Mode=OneTime}">
                <TextBlock.ToolTip>
                    <TextBlock Text="{Binding Path=RelationshipName, Mode=OneTime}"/>
                </TextBlock.ToolTip>
            </TextBlock>
        </Grid>
    </DataTemplate>
    <DataTemplate DataType="{x:Type vm:GraphicalDependencyItemViewModel}">
        <Grid>
            <Border BorderThickness="1" CornerRadius="15" BorderBrush="Black" Background="White">
                <TextBlock x:Name="textBlock" HorizontalAlignment="Center" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" 
                           Text="{Binding Path=DomainElementName, Mode=OneWay}">
                    <TextBlock.ToolTip>
                        <TextBlock Text="{Binding Path=DomainElementFullName, Mode=OneTime}"/>
                    </TextBlock.ToolTip>
                </TextBlock>
            </Border>
        </Grid>
        <DataTemplate.Triggers>
            <DataTrigger Binding="{Binding Path=DomainElementHasName}" Value="False">
                <Setter TargetName="textBlock" Property="Text" Value="{Binding Path=DomainElementFullName, Mode=OneWay}"/>
            </DataTrigger>
        </DataTemplate.Triggers>

    </DataTemplate>
    <DataTemplate DataType="{x:Type vm:GraphicalDependencyMainItemViewModel}">
        <Grid>
            <Border BorderThickness="1" BorderBrush="Silver">
                <TextBlock Margin="5" x:Name="textBlock" Grid.Column="1" TextTrimming="CharacterEllipsis"
                           HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding Path=DomainElementName, Mode=OneWay}">
                        <TextBlock.ToolTip>
                            <TextBlock Text="{Binding Path=DomainElementFullName, Mode=OneWay}"/>
                        </TextBlock.ToolTip>
                    </TextBlock>
            </Border>
        </Grid>
        <DataTemplate.Triggers>
            <DataTrigger Binding="{Binding Path=DomainElementHasName}" Value="False">
                <Setter TargetName="textBlock" Property="Text" Value="{Binding Path=DomainElementFullName, Mode=OneWay}"/>
            </DataTrigger>
        </DataTemplate.Triggers>
    </DataTemplate>

    <Style x:Key="DependencyLinkStyle" TargetType="Path">
        <Setter Property="StrokeThickness" Value="1"/>
        <Setter Property="Stroke" Value="Black"/>
    </Style>
    <DataTemplate DataType="{x:Type vm:GraphicalDependencyLinkViewModel}">
        <ctrl:DiagramDesignerItemLink StartAnchorStyle="None" EndAnchorStyle="Arrow" PathStyle="{StaticResource DependencyLinkStyle}"/>
    </DataTemplate>
</ResourceDictionary>